from elasticsearch_dsl import Document,Nested,Date,Boolean,analyzer,Completion,Text,Keyword,Integer
from elasticsearch_dsl.connections import connections

# 新建连接
connections.create_connection(hosts="127.0.0.1")

class ArticleType(Document):
    # 文章类型
    # create_date = Date()

    text = Text(analyzer="ik_max_word")
    comment = Text(analyzer="ik_max_word")
    url = Keyword()


    class Meta:
        # 数据库名称和表名称
        index = "snow"
        doc_type = "News_flash"

if __name__ == '__main__':
    ArticleType.init()